import type { Recordable } from '@vben/types';

import { requestClient } from '#/api/request';

export namespace SystemAuditLogApi {
  export interface AuditLog {
    [key: string]: any;
    id: string;
    user_id: number;
    username: string;
    module: string;
    summary: string;
    method: string;
    path: string;
    status: number;
    response_time: number;
    request_args?: any;
    response_body?: any;
    created_at: string;
    updated_at: string;
  }
}

/**
 * 获取审核日志列表数据
 */
async function getAuditLogList(params: Recordable<any>) {
  return requestClient.get<Array<SystemAuditLogApi.AuditLog>>(
    '/v1/auditlog/list',
    { params },
  );
}

/**
 * 根据ID获取审核日志详情
 */
async function getAuditLogById(id: number | string) {
  return requestClient.get<SystemAuditLogApi.AuditLog>(`/v1/auditlog/${id}`);
}

export { getAuditLogById, getAuditLogList };
